import { useRef, useCallback } from 'react'

const useSetRef = (initialState) => {
    const ref = useRef(initialState)
    const setMergeRef = useCallback((data) => {
        Object.keys(data).forEach(key => {
            ref.current[key] = data[key]
        })
    }, [])
    return [ref.current, setMergeRef]
}
export default useSetRef
